﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="taxilist.ascx.cs" Inherits="taxilist" %>
<asp:GridView ID="taxiinfo" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="ID" DataSourceID="SqlDataSource1" 
    onrowcommand="taxiinfo_RowCommand">
    <Columns>
        <asp:ButtonField DataTextField="PlateNo" HeaderText="PlateNo" CommandName="Select" SortExpression="PlateNo" />
        <asp:BoundField DataField="DriverName" HeaderText="DriverName" 
            SortExpression="DriverName" />
        <asp:BoundField DataField="CustomerArriveTime" HeaderText="CustomerArriveTime" 
            SortExpression="CustomerArriveTime" />
        <asp:BoundField DataField="Available" HeaderText="Available" 
            SortExpression="Available" />
            <asp:TemplateField Visible="False">
            <ItemTemplate>
            <asp:Button ID="CallTaxi" CommandName="Update" Text="Call" Enabled='<%#(Eval("Available").ToString().Trim()=="ok")%>' runat="server"/>
            </ItemTemplate>
            </asp:TemplateField>
    </Columns>
    </asp:GridView>
    <asp:Panel ID="taxidetailspanel" runat="server" Visible="False">
    
    <asp:LinkButton ID="ayrintiback" runat="server" onclick="ayrintiback_Click">Back</asp:LinkButton>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataKeyNames="ID" DataSourceID="SqlDataSource2" Height="50px" Width="125px">
            <Fields>
                <asp:BoundField DataField="PlateNo" HeaderText="PlateNo" 
                    SortExpression="PlateNo" />
                <asp:BoundField DataField="DriverName" HeaderText="DriverName" 
                    SortExpression="DriverName" />
                <asp:BoundField DataField="Available" HeaderText="Available" 
                    SortExpression="Available" />
                <asp:BoundField DataField="DailyKm" HeaderText="DailyKm" 
                    SortExpression="DailyKm" />
                <asp:BoundField DataField="TotalKm" HeaderText="TotalKm" 
                    SortExpression="TotalKm" />
                <asp:BoundField DataField="Revenue" HeaderText="Revenue" 
                    SortExpression="Revenue" />
                <asp:BoundField DataField="MaxKmLimit" HeaderText="MaxKmLimit" 
                    SortExpression="MaxKmLimit" />
                <asp:CheckBoxField DataField="DayNight" HeaderText="DayNight" 
                    SortExpression="DayNight" />
                <asp:BoundField DataField="CustomerArriveTime" HeaderText="CustomerArriveTime" 
                    SortExpression="CustomerArriveTime" />
            </Fields>
        </asp:DetailsView>
</asp:Panel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>"   
    SelectCommand="SELECT dbo.Taxi.PlateNo, dbo.Taxi.DailyKm, dbo.Taxi.TotalKm, dbo.Taxi.Revenue, dbo.Taxi.Available, dbo.Taxi.MaxKmLimit, dbo.Taxi.DayNight, dbo.Taxi.CustomerArriveTime, dbo.Taxi.DriverSSN, dbo.Taxi.ID, dbo.Driver.Name AS DriverName, dbo.Driver.SSN FROM dbo.Taxi INNER JOIN dbo.Driver ON dbo.Taxi.DriverSSN = dbo.Driver.SSN"
    >
   
    
</asp:SqlDataSource>


<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>"   
    SelectCommand="SelectDriverAndTaxiByTaxiId" SelectCommandType="StoredProcedure"
    >
    <SelectParameters>
        
        <asp:ControlParameter ControlID="taxiinfo" Name="id" 
            PropertyName="SelectedValue" Type="Int32" />
    </SelectParameters>
   
    
</asp:SqlDataSource>


